import cv2
import numpy as np
from PIL import Image, ImageOps
import os

def compress(im, ratio):
    w=im.shape[1]
    h=int(im.shape[0]*ratio)

    left_pad = 0
    top_pad = 0
    right_pad = 0
    bottom_pad = 0

    padding = (left_pad, top_pad, right_pad, bottom_pad)
    im=cv2.resize(im,(w,h))
    #im=cv2.copyMakeBorder(im,0,0,w,0,cv2.BORDER_CONSTANT)

    return im